(if (fboundp 'normal-top-level-add-subdirs-to-load-path)
    (let* ((my-lisp-dir "~/.emacs.d/")
           (default-directory my-lisp-dir))
      (setq load-path (cons my-lisp-dir load-path))
      (normal-top-level-add-subdirs-to-load-path)))

(load "ruby-config")
(load "misc-config")
(load "macro-config")
(load "gnus-config")
(load "muse-config")

(eval-after-load "dired" '(require 'dired+))
(eval-after-load "dired-x" '(require 'dired+))

;;######################################################################
(require 'rcodetools)
(require 'icicles-rcodetools)
(setq rct-find-tag-if-available nil)
(setq rct-debug t)
(setq ri-ruby-script "d:/home/.emacs.d/site-lisp/ruby/ri-emacs.rb")
(autoload 'ri "d:/home/.emacs.d/site-lisp/ruby/ri-ruby.el" nil t)

(require 'rhtml-mode)
(require 'rails)

(require 'rcov)
;;######################################################################

(autoload 'css-mode "css-mode" "Mode for editing CSS files" t)

(setq auto-mode-alist
      (append (list
               '("\\.css$" . css-mode)
               '("\\.rb\\'" . ruby-mode)
               '("Rakefile" . ruby-mode))
              auto-mode-alist))

;;######################################################################
;;                 TABBAR MODE
;;######################################################################
(require 'tabbar)
(tabbar-mode t)
(global-set-key [(control tab)] 'tabbar-forward)
(global-set-key [(control shift tab)] 'tabbar-backward)

;; Mail Account of 126.com
(setq user-full-name "Eric Luo")
(setq user-mail-address "eric.python@126.com")

(setq send-mail-function 'smtpmail-send-it)
(setq smtpmail-default-smtp-server "smtp.126.com")
(setq smtpmail-smtp-server "smtp.126.com")
(setq smtpmail-debug-info t)
(setq smtpmail-auth-credentials
      '(("smtp.126.com" 25 "eric.python" "123659")))

(put 'narrow-to-page 'disabled nil)

;;################################################################################
;;                           Emacs SQL Setting
;;################################################################################
;; emacs
;; Make mysql not buffer sending stuff to the emacs-subprocess-pipes
;; -n unbuffered -B batch(tab separated) -f force(go on after error)
;; -i ignore spaces -q no caching -t table format
(setq-default sql-mysql-options (quote ("-n" "-B" "-f" "-i" "-q" "-t")))

;; For Oracle
;(setq-default sql-oracle-options (quote ("footprint/cyberdb@cyberdb55")))
(setq-default sql-oracle-options (quote ("eric/snow327@test3_localhost")))
;(setq-default sql-password "cyberdb")

;;############################################################
;;
;;############################################################
(require 'psvn)
;;highlight the current line
(require 'hl-line)
(global-hl-line-mode t)

(require 'ido)
(ido-mode t)
(global-font-lock-mode 1)
(desktop-save-mode 1)
(setq font-lock-maximum-decoration t)
(setq font-lock-global-modes '(not text-mode))
(setq font-lock-verbose t)
(setq comint-process-echoes t)

(setq version-control 'never)
(setq dired-recursive-deletes t)
(tool-bar-mode -1)
(blink-cursor-mode -1)
(show-paren-mode 1)
(fset 'yes-or-no-p 'y-or-n-p)
(setq suggest-key-bindings 1)
(setq inhibit-startup-message t)
(setq default-directory "~")
(auto-image-file-mode t)
(setq default-major-mode 'text-mode)
(setq-default abbrev-mode t)
(setq make-backup-files nil)

;; set the default coding system to utf-8
(modify-coding-system-alist 'file "\\.rb$" 'utf-8)
(modify-coding-system-alist 'file "\\.rhtml$" 'utf-8)

;; display timer
(setq display-time-24hr-format t)
(setq display-time-day-and-date t)
(display-time)

;; enhanced change buffer
(iswitchb-mode t)
;; support compressed file
(auto-compression-mode t)
(auto-revert-mode t)

(setq enable-recursive-minibuffers t)
(setq make-backup-file nil)
(setq bookmark-save-flag 1)
;turn on Auto Fill mode automatically in Text mode
(add-hook 'text-mode-hook 'text-mode-hook-identify)
;;(add-hook 'text-mode-hook 'turn-on-auto-fill)
(setq colon-double-space t)
(setq x-select-enable-clipboard t)

(autoload 'eim-use-package "eim" "Another emacs input method")
;;(register-input-method
;; "eim-wb" "euc-cn" 'eim-use-package
;; "浜旂瑪" "浜旂瑪" "~/.emacs.d/site-lisp/eim/wb.txt")
(register-input-method
 "eim-py" "euc-cn" 'eim-use-package
 "鎷奸煶" "B" "~/.emacs.d/site-lisp/eim/py.txt")
;(set-input-method 'eim-py)


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; for icicles
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(load "icicles-config")

(server-start)